//
//  XXJLoginRegisterViewController.m
//  不得姐
//
//  Created by 许小军 on 16/9/3.
//  Copyright © 2016年 wyzc. All rights reserved.
//

#import "XXJLoginRegisterViewController.h"
#import "XXJLoginRegistView.h"
#import "XXJLoginView.h"
@interface XXJLoginRegisterViewController ()
@property (weak, nonatomic) IBOutlet UIView *middleView;
@property (weak, nonatomic) IBOutlet NSLayoutConstraint *leadCons;
@property (weak, nonatomic) IBOutlet XXJLoginView *bottomView;

@end

@implementation XXJLoginRegisterViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    XXJLoginRegistView * login=[XXJLoginRegistView loginView];
    
    [self.middleView addSubview:login];
    
    
    XXJLoginRegistView * rigest=[XXJLoginRegistView registView];
    [self.middleView addSubview:rigest];
    
    XXJLoginView * loginView=[XXJLoginView fastLoginView];
    [self.bottomView addSubview:loginView];
    
    
}


- (IBAction)back:(id)sender {
    
    [self dismissViewControllerAnimated:YES completion:nil];
}

- (IBAction)rigest:(UIButton *)sender {
    sender.selected=!sender.selected;
    
    _leadCons.constant=_leadCons.constant==0?-self.middleView.frame.size.width*0.5:0;
    
    [UIView animateWithDuration:0.05 animations:^{
        [self.view layoutIfNeeded];
    }];
    
}


-(void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];
    
    
    XXJLoginRegistView * loginView=self.middleView.subviews[0];
    loginView.frame=CGRectMake(0, 0, self.middleView.frame.size.width*0.5, self.middleView.frame.size.height);
    
    XXJLoginRegistView * rigestView=self.middleView.subviews[1];
    rigestView.frame=CGRectMake(self.middleView.frame.size.width*0.5, 0, self.middleView.frame.size.width*0.5, self.middleView.frame.size.height);
    
    
    
    
    
}






- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
